const express = require("express");
const router = express.Router();
const {
  getAllComments,
  updateIsOnline,
} = require("../../router_handler/admin/comment");
router.get("/getcomment/:page/:limit/:type", async (req, res) => {
  const page = parseInt(req.params.page);
  const limit = parseInt(req.params.limit);
  const type = parseInt(req.params.type);
  const offset = (page - 1) * limit;
  const result = await getAllComments(page, limit, type, offset);
  res.send(result);
});

router.post("/updateisonline/:id/:isOnline", async (req, res) => {
  const id = parseInt(req.params.id);
  const isOnline = parseInt(req.params.isOnline);
  const result = await updateIsOnline(id, isOnline);
  res.send(result);
});
module.exports = router;
